package com.jiangjj.ssmdemo;

import com.jiangjj.ssmdemo.city.City;
import com.jiangjj.ssmdemo.city.CityRepository;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class SsmdemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(SsmdemoApplication.class, args);
    }

    //@Bean
    CommandLineRunner commandLineRunner(CityRepository cityRepository) {
        return new CommandLineRunner() {
            @Override
            public void run(String... args) throws Exception {
                City city = new City();
                city.setName("GuangZhou");
                city.setCountry("China");
                cityRepository.save(city);
            }
        };

    }
}
